﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pad
{
    [Serializable]
    class Note
    {
        private class CompareByFam : IComparer<Note>
        {
            public int Compare(Note one, Note two)
            {
                return String.Compare(one.LastName, two.LastName);
            }
        }
        private class CompareByName : IComparer<Note>
        {
            public int Compare(Note one, Note two)
            {
                return String.Compare(one.FirstName, two.FirstName);
            }
        }
        private class CompareByDR : IComparer<Note>
        {
            public int Compare(Note one, Note two)
            {
                if (one.BirthDay > two.BirthDay) return 1;
                if (one.BirthDay < two.BirthDay) return -1;
                return 0;
            }
        }
        public string LastName { get; private set; }
        public string FirstName { get; private set; }
        public string Phone { get; private set; }
        public int BirthDay { get; private set; }
        public Note(string f, string n, string p, int d) { LastName = f; FirstName = n; Phone = p; BirthDay = d; }
        public static IComparer<Note> SortByName { get { return new CompareByName(); } }
        public static IComparer<Note> SortByDR { get { return new CompareByDR(); } }
        public static IComparer<Note> SortByFam { get { return new CompareByFam(); } }
    }
}
